import 'package:flutter_base_app/generated/json/base/json_convert_content.dart';
import 'package:flutter_base_app/utils/user/user_data.dart';
import 'package:flutter_base_app/utils/user/user_help.dart';


UserData $UserDataFromJson(Map<String, dynamic> json) {
  final UserData userData = UserData();
  final String? userId = jsonConvert.convert<String>(json['userId']);
  if (userId != null) {
    userData.userId = userId;
  }
  final String? userName = jsonConvert.convert<String>(json['userName']);
  if (userName != null) {
    userData.userName = userName;
  }
  final String? email = jsonConvert.convert<String>(json['email']);
  if (email != null) {
    userData.email = email;
  }
  final String? token = jsonConvert.convert<String>(json['token']);
  if (token != null) {
    userData.token = token;
  }
  final String? refreshToken = jsonConvert.convert<String>(json['refreshToken']);
  if (refreshToken != null) {
    userData.refreshToken = refreshToken;
  }
  final String? updateTime = jsonConvert.convert<String>(json['updateTime']);
  if (updateTime != null) {
    userData.updateTime = updateTime;
  }
  return userData;
}

Map<String, dynamic> $UserDataToJson(UserData entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  data['userId'] = entity.userId;
  data['userName'] = entity.userName;
  data['email'] = entity.email;
  data['token'] = entity.token;
  data['refreshToken'] = entity.refreshToken;
  data['updateTime'] = entity.updateTime;
  return data;
}

extension UserDataExtension on UserData {
  UserData copyWith({
    String? userId,
    String? userName,
    String? email,
    String? token,
    String? refreshToken,
    String? updateTime,
  }) {
    return UserData()
      ..userId = userId ?? this.userId
      ..userName = userName ?? this.userName
      ..email = email ?? this.email
      ..token = token ?? this.token
      ..refreshToken = refreshToken ?? this.refreshToken
      ..updateTime = updateTime ?? this.updateTime;
  }
}

UserInfoData $UserInfoDataFromJson(Map<String, dynamic> json) {
  final UserInfoData userInfoData = UserInfoData();
  final String? id = jsonConvert.convert<String>(json['id']);
  if (id != null) {
    userInfoData.id = id;
  }
  final String? age = jsonConvert.convert<String>(json['age']);
  if (age != null) {
    userInfoData.age = age;
  }
  final int? gender = jsonConvert.convert<int>(json['gender']);
  if (gender != null) {
    userInfoData.gender = gender;
  }
  final String? headImg = jsonConvert.convert<String>(json['headImg']);
  if (headImg != null) {
    userInfoData.headImg = headImg;
  }
  final int? height = jsonConvert.convert<int>(json['height']);
  if (height != null) {
    userInfoData.height = height;
  }
  final String? userName = jsonConvert.convert<String>(json['userName']);
  if (userName != null) {
    userInfoData.userName = userName;
  }
  final String? nickname = jsonConvert.convert<String>(json['nickname']);
  if (nickname != null) {
    userInfoData.nickname = nickname;
  }
  final int? weight = jsonConvert.convert<int>(json['weight']);
  if (weight != null) {
    userInfoData.weight = weight;
  }
  final String? qrCode = jsonConvert.convert<String>(json['qrCode']);
  if (qrCode != null) {
    userInfoData.qrCode = qrCode;
  }
  return userInfoData;
}

Map<String, dynamic> $UserInfoDataToJson(UserInfoData entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  data['id'] = entity.id;
  data['age'] = entity.age;
  data['gender'] = entity.gender;
  data['headImg'] = entity.headImg;
  data['height'] = entity.height;
  data['userName'] = entity.userName;
  data['nickname'] = entity.nickname;
  data['weight'] = entity.weight;
  data['qrCode'] = entity.qrCode;
  return data;
}

extension UserInfoDataExtension on UserInfoData {
  UserInfoData copyWith({
    String? id,
    String? age,
    int? gender,
    String? headImg,
    int? height,
    String? userName,
    String? nickname,
    int? weight,
    String? qrCode,
  }) {
    return UserInfoData()
      ..id = id ?? this.id
      ..age = age ?? this.age
      ..gender = gender ?? this.gender
      ..headImg = headImg ?? this.headImg
      ..height = height ?? this.height
      ..userName = userName ?? this.userName
      ..nickname = nickname ?? this.nickname
      ..weight = weight ?? this.weight
      ..qrCode = qrCode ?? this.qrCode;
  }
}